package program;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import basicPackage.*;
import dungeon.*;

public class ProgramCompositeDungeon {
	
	public static void main(String[] args) throws IllegalArgumentException, InherentlySlipperyLimitViolatedException {
		CompositeDungeon<Dungeon<?>> compositeDungeon = new CompositeDungeon<Dungeon<?>>(new Coordinate(8,15,7));
		Level<Square> level = new Level<Square>(new Coordinate(3,3,0));
		Shaft<AccessibleSquare> shaft = new Shaft<AccessibleSquare>(new Coordinate(0,0,5));
		
		//Level
		RockSquare rock162 = new RockSquare();
		RockSquare rock262 = new RockSquare();
		NormalSquare square362 = new NormalSquare(new Temperature(20), new BigDecimal("50.00"), false, Direction.WEST);
		NormalSquare square172 = new NormalSquare(new Temperature(30), new BigDecimal("60.00"), false, Direction.CEILING);
		NormalSquare square272 = new NormalSquare(new Temperature(20), new BigDecimal("50.00"), false, Direction.SOUTH);
		TransparentSquare transsquare372 = new TransparentSquare(new Temperature(20), new Temperature(-200), new Temperature(5000), new BigDecimal("50.00"), false, Direction.SOUTH);
		NormalSquare square182 = new NormalSquare(new Temperature(20), new BigDecimal("50.00"), false, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST);
		NormalSquare square282 = new NormalSquare(new Temperature(20), new BigDecimal("50.00"), true, Direction.WEST);
		TransparentSquare transsquare382 = new TransparentSquare(new Temperature(20), new Temperature(-200), new Temperature(5000), new BigDecimal("50.00"), false, Direction.SOUTH);
		
		//Shaft
		NormalSquare square291 = new NormalSquare();
		NormalSquare square292 = new NormalSquare(new Temperature(20), new BigDecimal("50.00"), false, Direction.SOUTH);
		List<AccessibleSquare> destinations = new ArrayList<AccessibleSquare>();
		destinations.add(square172);
		NormalTeleportationSquare telsquare293 = new NormalTeleportationSquare(new Temperature(20), new Temperature(-200), new Temperature(5000), new BigDecimal("50.00"), false,destinations, Direction.NORTH);
		
		//Level
		level.placeSquare(new Coordinate(1,1,0), rock162);
		level.placeSquare(new Coordinate(2,1,0), rock262);
		level.placeSquare(new Coordinate(3,1,0), square362);
		level.placeSquare(new Coordinate(1,2,0), square172);
		level.placeSquare(new Coordinate(2,2,0), square272);
		level.placeSquare(new Coordinate(3,2,0), transsquare372);
		level.placeSquare(new Coordinate(1,3,0), square182);
		level.placeSquare(new Coordinate(2,3,0), square282);
		level.placeSquare(new Coordinate(3,3,0), transsquare382);
		
		//Shaft
		shaft.placeSquare(new Coordinate(0,0,1), square291);
		shaft.placeSquare(new Coordinate(0,0,2), square292);
		shaft.placeSquare(new Coordinate(0,0,3), telsquare293);
		
		//Composite Dungeon
		compositeDungeon.addDungeon(new Coordinate(0,5,2), level);
		compositeDungeon.addDungeon(new Coordinate(2,9,0), shaft);
		
		System.out.print("Does the shaft border the level through a wall: ");
		System.out.println(square292.getBorderingSquare(Direction.SOUTH)== square282);
		System.out.println();
		
		System.out.println("The accessible squares from square291 in the shaft are:");
		for(AccessibleSquare square:square291.getAccessibleSquares()){
			System.out.print(square.getClass().getCanonicalName());
			if(level.containsSquare(square))
				System.out.println(" in level.");
			if(shaft.containsSquare(square))
				System.out.println(" in shaft.");
		}
		
	}

}
